<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TCP/IP协议：现代网络通信的基石</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .layer-card {
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(10px);
        }
        .feature-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            bottom: -10px;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6" style="font-family: 'Noto Serif SC', serif;">
                TCP/IP协议
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                现代网络通信的核心支柱
            </p>
            <div class="flex justify-center space-x-8 text-sm md:text-base">
                <div class="flex items-center">
                    <i class="fas fa-network-wired mr-2"></i>
                    <span>分层架构</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-shield-alt mr-2"></i>
                    <span>可靠传输</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-globe mr-2"></i>
                    <span>全球互联</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 px-6">
        <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-xl p-8 md:p-12">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">T</span>CP/IP协议是一个功能强大且广泛应用的网络协议栈，它通过分层设计和模块化架构，为各种应用提供了灵活、可靠的网络通信服务。其支持异构网络的互联、端到端的可靠传输、无连接的快速传输以及丰富的应用协议，使其成为现代网络通信的核心支柱。
            </p>
        </div>
    </section>

    <!-- Working Principle Section -->
    <section class="py-16 px-6 bg-gray-50">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-4xl font-bold text-center mb-4 text-gray-800 relative inline-block section-title" style="font-family: 'Noto Serif SC', serif;">
                TCP/IP 协议的工作原理
            </h2>
            <p class="text-center text-gray-600 mb-12 max-w-3xl mx-auto">
                TCP/IP协议栈采用四层架构设计，每一层都具有特定的功能和协议，协同工作来实现数据的可靠传输和通信。
            </p>

            <!-- Protocol Stack Visualization -->
            <div class="mb-12">
                <div class="mermaid">
                    graph TD
                        A[应用层<br/>HTTP, FTP, SMTP] --> B[传输层<br/>TCP, UDP]
                        B --> C[网络层<br/>IP, ICMP, ARP]
                        C --> D[网络接口层<br/>Ethernet, Wi-Fi]
                        
                        style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                        style B fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                        style C fill:#8b5cf6,stroke:#fff,stroke-width:2px,color:#fff
                        style D fill:#a855f7,stroke:#fff,stroke-width:2px,color:#fff
                </div>
            </div>

            <!-- Layer Cards -->
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Application Layer -->
                <div class="layer-card rounded-xl p-8 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-layer-group text-2xl feature-icon"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">应用层</h3>
                    </div>
                    <div class="space-y-3">
                        <div>
                            <span class="font-semibold text-purple-600">功能：</span>
                            <span class="text-gray-700">提供网络服务给应用程序，处理特定应用程序协议（如HTTP、FTP、SMTP等）。</span>
                        </div>
                        <div>
                            <span class="font-semibold text-purple-600">工作原理：</span>
                            <span class="text-gray-700">应用程序通过应用层协议来启动数据传输，这些协议定义了数据的格式和语义。当应用程序需要与另一台主机上的应用程序进行通信时，应用层协议会生成适当的请求或响应。</span>
                        </div>
                    </div>
                </div>

                <!-- Transport Layer -->
                <div class="layer-card rounded-xl p-8 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-exchange-alt text-2xl feature-icon"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">传输层</h3>
                    </div>
                    <div class="space-y-3">
                        <div>
                            <span class="font-semibold text-purple-600">功能：</span>
                            <span class="text-gray-700">负责数据的可靠传输、端到端的连接、流量控制、差错校验等。主要协议有TCP和UDP。</span>
                        </div>
                        <div>
                            <span class="font-semibold text-purple-600">工作原理：</span>
                            <span class="text-gray-700">TCP提供可靠的、面向连接的数据流传输，通过三次握手建立连接，使用序列号和确认号确保数据的有序、完整传输。UDP则提供不可靠的、无连接的传输方式，适用于对时延敏感的应用。</span>
                        </div>
                    </div>
                </div>

                <!-- Network Layer -->
                <div class="layer-card rounded-xl p-8 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-route text-2xl feature-icon"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">网络层</h3>
                    </div>
                    <div class="space-y-3">
                        <div>
                            <span class="font-semibold text-purple-600">功能：</span>
                            <span class="text-gray-700">负责数据包的寻址与路由，定义了如何通过多个网络传输数据。核心协议是IP。</span>
                        </div>
                        <div>
                            <span class="font-semibold text-purple-600">工作原理：</span>
                            <span class="text-gray-700">IP协议将数据包封装成数据报，负责将其从源主机传送到目标主机。IP协议负责选择合适的路由，并处理数据报的分片与重组。还包括ICMP和ARP等协议。</span>
                        </div>
                    </div>
                </div>

                <!-- Network Interface Layer -->
                <div class="layer-card rounded-xl p-8 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-ethernet text-2xl feature-icon"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">网络接口层</h3>
                    </div>
                    <div class="space-y-3">
                        <div>
                            <span class="font-semibold text-purple-600">功能：</span>
                            <span class="text-gray-700">负责将IP数据报封装成底层网络帧，管理物理设备上的数据传输。</span>
                        </div>
                        <div>
                            <span class="font-semibold text-purple-600">工作原理：</span>
                            <span class="text-gray-700">包含底层网络协议（如以太网、Wi-Fi），负责定义如何通过物理介质传输数据帧。将网络层的数据包封装成适合物理传输的帧。</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 px-6">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-4xl font-bold text-center mb-12 text-gray-800" style="font-family: 'Noto Serif SC', serif;">
                TCP/IP 协议的特点
            </h2>

            <!-- Features Grid -->
            <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl p-6 shadow-lg card-hover">
                    <div class="w-14 h-14 bg-gradient-to-br from-purple-500 to-pink-500 rounded-xl flex items-center justify-center mb-4">
                        <i class="fas fa-cubes text-white text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">模块化设计</h3>
                    <p class="text-gray-600">TCP/IP协议栈采用模块化设计，协议分为多个层次，每一层只负责特定的功能，彼此独立。各层之间通过标准接口进行通信，提高了协议的灵活性和可扩展性。</p>
                </div>

                <div class="bg-white rounded-xl p-6 shadow-lg card-hover">
                    <div class="w-14 h-14 bg-gradient-to-br from-blue-500 to-cyan-500 rounded-xl flex items-center justify-center mb-4">
                        <i class="fas fa-layer-group text-white text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">分层架构</h3>
                    <p class="text-gray-600">分层架构将网络通信的复杂性进行了抽象，每一层独立实现自己的功能，简化了开发和维护。传输层可以选择TCP或UDP以适应不同的应用需求。</p>
                </div>

                <div class="bg-white rounded-xl p-6 shadow-lg card-hover">
                    <div class="w-14 h-14 bg-gradient-to-br from-green-500 to-teal-500 rounded-xl flex items-center justify-center mb-4">
                        <i class="fas fa-network-wired text-white text-2xl"></i>
                    </div>
                    <h3 class="text